package com.nhim.cms.admin.client.place;

import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.google.gwt.place.shared.Prefix;
import com.google.gwt.requestfactory.shared.EntityProxyId;
import com.google.gwt.requestfactory.shared.RequestFactory;
import com.nhim.cms.admin.shared.ElementDefinitionProxy;

public class ElementDefinitionPlace extends Place {

	private final EntityProxyId<ElementDefinitionProxy> elementDefinitionId;
	 public ElementDefinitionPlace(
		      EntityProxyId<ElementDefinitionProxy> elementDefinitionId) {;
		    this.elementDefinitionId = elementDefinitionId;
		  }

	  public EntityProxyId<ElementDefinitionProxy> getElementDefinitionId() {
	    return elementDefinitionId;
	  }
	  @Prefix("edf")
	  public static class Tokenizer implements PlaceTokenizer<ElementDefinitionPlace> {
		    private final RequestFactory requests;
		    public Tokenizer( RequestFactory requests) {
		        this.requests = requests;
		    }
	        public String getToken(ElementDefinitionPlace place) {
	             return requests.getHistoryToken(place.getElementDefinitionId());
	        }
			public ElementDefinitionPlace getPlace(String token) {
				return new ElementDefinitionPlace( requests.<ElementDefinitionProxy> getProxyId(token));
			}
	    }

	
	}
